package gamePackage;

//imports
import java.awt.*;
import javax.swing.*;

public class Projectile { //Player projectile class

	Image playAmmo; //Projectile image variable
	boolean visible = true; //Projectile detect off screen or collision
	int x, y; //Projectile position
	
	//Constructor
	public Projectile(int xStart, int yStart) {
		
		//Projectile starting position
		x = xStart;
		y = yStart;
		
		ImageIcon imgGet = new ImageIcon("src/playAmmo.png");
		playAmmo = imgGet.getImage();
		
	} //End constructor
	
	//Bullet hit detection
	public Rectangle getSize(){
		return new Rectangle(x,y, 42,50);
	}
	
	//Return methods for projectile handling
	public int px() {
		return x;
	}
	public int py() {
		return y;
	}
	public boolean pvis() {
		return visible;
	}
	public Image pimg() {
		return playAmmo;
	}
	
	public void move() { //Projectile pathing
		
		x = x + 8; //Projectile speed (x + pixels/5ms)
		if (x > 985) { //Projectile disappears after reaching screen right border
			visible = false;
		}
		
	}
	
} //End class
